package com.alibaba.feign;

import com.alibaba.domain.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

//@FeignClient(value = "user-server", fallback = UserFeignClientFallback.class)
@FeignClient(value = "user-server",fallbackFactory = UserFeignClientFallbackFactory.class)
public interface UserFeign {
    /**
     * 使用openfeign  注意!!!   四个相同
     * feignClient中的value要和需要调用的服务的applicationName相同
     * 请求路径要相同
     * 请求参数要相同
     * 返回值类型要相同
     */
    @GetMapping("/getUserById/{id}")
    User getUserById(@PathVariable("id") Long id);
}
